package com.jbp.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jbp.dao.ApplePayGoodsDao;
import com.jbp.model.ApplePayGoods;
import com.jbp.service.ApplePayGoodsService;
import org.springframework.stereotype.Service;
import com.jbp.utils.PageUtils;
import com.jbp.utils.Query;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 苹果支付商品(ApplePayGoods)表服务实现类
 * @author cc
 * @since 2021-08-26 19:35:32
 */
@Service
public class ApplePayGoodsServiceImpl extends ServiceImpl<ApplePayGoodsDao, ApplePayGoods> implements ApplePayGoodsService {
    @Override
    public List<String> appleGoodsList() {
        List<String> list = list().stream().map(ApplePayGoods::getAppleId).collect(Collectors.toList());
        return list;
    }

    @Override
    public ApplePayGoods getByProductId(String productId) {
        QueryWrapper<ApplePayGoods> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("apple_id", productId);
        return getOne(queryWrapper);
    }
}